#pragma once

#include "Common/MessageDispatch/MessageDispatch.h"

class LogicRoomModule : public IClientMessageHandler,public IServerMessageHandler
{
public:
	bool Init();
	void UnInit();
	/////////////////////////////////  IServerMessageHandler /////////////////////////////////////////
	virtual void		onClientMessage(uint32_t actionId, RECV_PACKAGE& package, uint64_t Id = 0);
	virtual const char* getClientHandlerDebugInfo(void) { return "LogicRoomModule::onClientMessage"; };
	//////////////////////////////  IServerMessageHandler ////////////////////////////////////////////
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "LogicRoomModule::onServerMessage"; }
private:
	//房间列表
	void RoomList(Player *pPlayer, RECV_PACKAGE &package);
	//创建房间
	void CreateRoom(Player *pPlayer,RECV_PACKAGE &package);
	//设置密码
	void SetRoomPwd(Player *pPlayer, RECV_PACKAGE &package);
	//加入房间
	void JoinRoom(Player *pPlayer, RECV_PACKAGE &package);
	//邀请好友
	void InviteFriend(Player *pPlayer, RECV_PACKAGE &package);
	//回复邀请
	void ReplyInvite(Player *pPlayer, RECV_PACKAGE &package);
	//请离房间
	void KickRoom(Player *pPlayer, RECV_PACKAGE &package);
	//离开房间
	void LeaveRoom(Player *pPlayer, RECV_PACKAGE &package);
	//自动加入
	void AutoJoin(Player *pPlayer, RECV_PACKAGE &package);
public:
	//通知逻辑服更新玩家房间
	void CharRoomNotify(RECV_PACKAGE &package);
public:
	LogicRoomModule();
	virtual ~LogicRoomModule();
};